package com.itcast.spark.baseDataStruct

import org.apache.spark.mllib.regression.LabeledPoint
import org.apache.spark.mllib.util.MLUtils
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.SparkSession
import org.apache.spark.{SparkConf, SparkContext}

/**
 * DESC:本地向量--mllib的LabeledPoint
 */
object _03libsvm {
  def main(args: Array[String]): Unit = {
    val conf: SparkConf = new SparkConf().setAppName("_03libsvm").setMaster("local[*]")
    val spark: SparkSession = SparkSession.builder().config(conf).getOrCreate()
    val sc: SparkContext = spark.sparkContext
    val path="D:\\BigData\\Workspace\\spark_learaning_2.11\\spark-study-day07_2.11\\src\\main\\resources\\libsvmWine.txt"
    val data: RDD[LabeledPoint] = MLUtils.loadLibSVMFile(sc, path)
    data.foreach(println(_))
  }
}
